
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE VIEW dbo.vwlConciliacion
AS
SELECT        dbo.tb_Conciliacion.idConciliacion AS ID, dbo.tb_Conciliacion.fechaConciliacion, dbo.tb_Conciliacion.Observaciones, dbo.tb_Inconsistencia.descripcion AS Inconsistencia, dbo.tb_Conciliacion.Usuario, 
                         dbo.tb_Agentes.Documento, dbo.tb_Agentes.Nombres, dbo.tb_CargosSalariales.cargo, dbo.tb_Plazas.CUPOF, dbo.tb_Organizaciones.CUISE, dbo.tb_Organizaciones.Nombre AS Organizacion, 
                         dbo.tb_SubOrganizaciones.Descripcion AS SubOrganizacion, dbo.tb_Plazas.idPlaza, dbo.tb_ServiciosAgentes.idServicioAgente
FROM            dbo.tb_SubserviciosAgentes INNER JOIN
                         dbo.tb_Plazas ON dbo.tb_SubserviciosAgentes.Plaza = dbo.tb_Plazas.idPlaza INNER JOIN
                         dbo.tb_Conciliacion INNER JOIN
                         dbo.tb_Inconsistencia ON dbo.tb_Conciliacion.Inconsistencia = dbo.tb_Inconsistencia.idInconsistencia INNER JOIN
                         dbo.tb_ServiciosAgentes ON dbo.tb_Conciliacion.Servicio = dbo.tb_ServiciosAgentes.idServicioAgente ON dbo.tb_SubserviciosAgentes.idSubServicio = dbo.tb_ServiciosAgentes.idServicioAgente INNER JOIN
                         dbo.tb_SubOrganizaciones ON dbo.tb_ServiciosAgentes.SubOrganizacion = dbo.tb_SubOrganizaciones.idSubOrganizacion INNER JOIN
                         dbo.tb_Organizaciones ON dbo.tb_ServiciosAgentes.UbicacionOrig = dbo.tb_Organizaciones.idOrganizaciones INNER JOIN
                         dbo.tb_Agentes ON dbo.tb_ServiciosAgentes.Agente = dbo.tb_Agentes.idAgente INNER JOIN
                         dbo.tb_CargosSalariales ON dbo.tb_ServiciosAgentes.CargoSalarial = dbo.tb_CargosSalariales.idCargo

GO
GRANT SELECT ON  [dbo].[vwlConciliacion] TO [AdministracionSagenet]
GRANT SELECT ON  [dbo].[vwlConciliacion] TO [conciliacion]
GO


EXEC sp_addextendedproperty N'MS_DiagramPane2', N'     Right = 507
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "tb_Agentes"
            Begin Extent = 
               Top = 154
               Left = 661
               Bottom = 284
               Right = 884
            End
            DisplayFlags = 280
            TopColumn = 2
         End
         Begin Table = "tb_CargosSalariales"
            Begin Extent = 
               Top = 187
               Left = 578
               Bottom = 317
               Right = 787
            End
            DisplayFlags = 280
            TopColumn = 1
         End
      End
   End
   Begin SQLPane = 
   End
   Begin DataPane = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 900
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End
', 'SCHEMA', N'dbo', 'VIEW', N'vwlConciliacion', NULL, NULL
GO


EXEC sp_addextendedproperty N'MS_DiagramPane1', N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[6] 4[55] 2[21] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1 [75] 4))"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 0
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "tb_SubserviciosAgentes"
            Begin Extent = 
               Top = 6
               Left = 571
               Bottom = 135
               Right = 819
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "tb_Plazas"
            Begin Extent = 
               Top = 33
               Left = 707
               Bottom = 162
               Right = 964
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "tb_Conciliacion"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 135
               Right = 247
            End
            DisplayFlags = 280
            TopColumn = 1
         End
         Begin Table = "tb_Inconsistencia"
            Begin Extent = 
               Top = 6
               Left = 285
               Bottom = 101
               Right = 494
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "tb_ServiciosAgentes"
            Begin Extent = 
               Top = 90
               Left = 360
               Bottom = 219
               Right = 610
            End
            DisplayFlags = 280
            TopColumn = 1
         End
         Begin Table = "tb_SubOrganizaciones"
            Begin Extent = 
               Top = 138
               Left = 38
               Bottom = 267
               Right = 260
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "tb_Organizaciones"
            Begin Extent = 
               Top = 240
               Left = 298
               Bottom = 369
          ', 'SCHEMA', N'dbo', 'VIEW', N'vwlConciliacion', NULL, NULL
GO

DECLARE @xp int
SELECT @xp=2
EXEC sp_addextendedproperty N'MS_DiagramPaneCount', @xp, 'SCHEMA', N'dbo', 'VIEW', N'vwlConciliacion', NULL, NULL
GO
